home *** CD-ROM | disk | FTP | other *** search
/ Best of Shareware / Best of PC Windows Shareware 1.0 - Wayzata Technology (7111) (1993).iso / mac / DOS / CAD_CAM / A7221V1B / INPUT.H < prev    next >
Text File  |  1992-03-12  |  3KB  |  102 lines

  1. /*
  2.    Module:  input.h
  3.    Date:    3/9/92
  4.    Version: 1.0b
  5.    Author:  Dave Lutz
  6.    Email:   lutz@psych.rochester.edu
  7.    Copyright: 1992 University of Rochester, Psychology Dept.
  8.  
  9.    Disclaimer:  This software is distributed free of charge.  As such, it
  10.                 comes with ABSOLUTELY NO WARRANTY.  The user of the software
  11.                 assumes ALL RISKS associated with its use.
  12.  
  13.                 Your rights to modify and/or distribute this software are
  14.                 outlined in the file SEND7221.DOC.
  15.  
  16.    Purpose: This module provides the function prototypes for the input
  17.             routines for the PC -> HP7221 controller.  It provides the 
  18.             routines needed by the controller to open the input file and 
  19.             read data.
  20.  
  21.             A datatype (PLTFILE) is also provided by this module.  This
  22.             datatype is the basic structure used by all of the functions in
  23.             this module.
  24.  
  25.    Functions Provided:
  26.  
  27.             openin
  28.             closein
  29.             fillbuff
  30.  
  31. */
  32.  
  33.  
  34.   /* BUFFSIZE has been set to get the maximum number of 2048 byte clusters
  35.      and still be less than 32767
  36.   */
  37. #define BUFFSIZE 30720
  38. #define PLTFILE struct _pltfile
  39.  
  40. PLTFILE {
  41.    char *buf;     /* start of file buffer */
  42.    int  fd,       /* file descriptor for the file */
  43.         buf_ctr,  /* number of bytes currently in buffer */
  44.         eof;      /* BOOLEAN flag */
  45. };
  46.  
  47.  
  48.  
  49. /*
  50.    Function: openin
  51.    Purpose:  Allocate the input buffer and open the input file for reading.
  52.  
  53.    Pre: name is a pointer to an ascii string containing the name of the 
  54.         input file.
  55.         pltfpp is a pointer to storage for a pointer to a PLTFILE.
  56.  
  57.    Post:  The input buffer is allocated.
  58.           The input file is opened for reading.
  59.           If the buffer can't be allocated, *pltfpp is set to NULL and
  60.           NOBUFF is returned.
  61.           If the input file can't be opened, *pltfpp is set to NULL and
  62.           BADOPEN is returned.
  63.           Otherwise, TRUE is returned.
  64. */
  65.  
  66. int openin (char *name, PLTFILE **pltfpp);
  67.  
  68.  
  69.  
  70. /*
  71.    Function: closein
  72.    Purpose:  Discard the input buffer, close the input file, and deallocate 
  73.              the input buffer.
  74.  
  75.    Pre:  pltfpp is a pointer to a pointer to a PLTFILE.
  76.          If *pltfpp does not point to an open PLTFILE, it is NULL.
  77.  
  78.    Post:  If *pltfpp = NULL, TRUE is returned.
  79.           Otherwise, the contents of the input buffer are discarded, the 
  80.           input file is closed, and the input buffer is deallocated.
  81.           If an error occurs during the above process, FALSE is returned.
  82. */
  83.  
  84. int closein(PLTFILE **pltfpp);
  85.  
  86.  
  87.  
  88. /*
  89.    Function: fillbuff
  90.    Purpose:  Read a block of data from the input file, filling the buffer
  91.              in the PLTFILE.
  92.  
  93.    Pre:  pltfp is a pointer to a PLTFILE that has been opened for reading.
  94.  
  95.    Post: The input file is read to refill the buffer in PLTFILE.
  96.          If end_of_file has already been reached, 0 is returned.
  97.          If an error occures, -1 is returned.
  98.          Otherwise, the number of bytes read from the file is returned.
  99. */
  100.  
  101. int fillbuff (PLTFILE *pltfp);
  102.